package Application.Controller;

import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Slider;
import javafx.scene.control.ComboBox;
import Application.Tool.*;
import javafx.scene.control.TextField;

public class ChannelPenSettingsController {
    @FXML private Slider sizeSetting;
    @FXML private ComboBox<String> maskSetting;
    @FXML private CheckBox aUsed, rUsed, gUsed, bUsed;
    @FXML private TextField deltaASetting, deltaRSetting, deltaGSetting, deltaBSetting;

    @FXML public void onSizeChanged() {
        int size = (int)sizeSetting.getValue();
        ChannelPen.getInstance().setSize(size);
    }

    @FXML public void onMaskChanged() {
        String maskName = maskSetting.getValue();

        ChannelPen.getInstance().setMask(maskName);
    }

    @FXML public void onAChanged() {
        boolean on = aUsed.isSelected();
        int delta = Integer.parseInt(deltaASetting.getText());
        ChannelPen.getInstance().setAlpha(on, delta);
    }

    @FXML public void onRChanged() {
        boolean on = rUsed.isSelected();
        int delta = Integer.parseInt(deltaRSetting.getText());
        ChannelPen.getInstance().setRed(on, delta);
    }

    @FXML public void onGChanged() {
        boolean on = gUsed.isSelected();
        int delta = Integer.parseInt(deltaGSetting.getText());
        ChannelPen.getInstance().setGreen(on, delta);
    }

    @FXML public void onBChanged() {
        boolean on = bUsed.isSelected();
        int delta = Integer.parseInt(deltaBSetting.getText());
        ChannelPen.getInstance().setBlue(on, delta);
    }

    public ComboBox<String> getCombo() {
        return maskSetting;
    }
}
